package com.yubest.designpattern.behavior.chain;

import lombok.Getter;

/**
 * 抽象处理类
 *
 * @Author: hweiyu
 * @Date: 2022/10/26 15:47
 */
public abstract class AbstractHandler {

    @Getter
    private AbstractHandler handler;

    public void nextHandler(AbstractHandler handler) {
        this.handler = handler;
    }

    public void handle(RequestObject object) {
        doHandle(object);
        if (null != getHandler()) {
            getHandler().handle(object);
        }
    }

    abstract void doHandle(RequestObject object);
}
